<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var obj = {}
      const str = 'asddfgdfwwqeweqwezczxcsdfgdgd'
      for (var i = 0; i < str.length; i++) {
        var k = str[i]
        if (obj[k]) {
          obj[k]++
        } else {
          obj[k] = 1
        }
      }
      var max = 0
      var maxchar = ''
      for (var i in obj) {
        if (max < obj[k]) {
          max = obj[k]
          maxchar = k
        }
      }
      console.log('出现最多的字符是：', maxchar)
      console.log('出现的次数是：', max)
    </script>
  </body>
</html>
